﻿<?php
define('IN_QY',true);
require("include/common.inc.php");	

$sql6 = "select * from tbl_delivery  where order_id='".$_GET['id']."'";
$query6=mysql_query($sql6);
$row6=mysql_fetch_array($query6);
//
header('Content-type:text/html;charset=utf-8');
$params = array(
  'key' => '3bb788766e8108d66a0034485195e932', //您申请的快递appkey
  'com' => $row6['delivery_com_id'], //快递公司编码，可以通过$exp->getComs()获取支持的公司列表
  'no'  => $row6['delivery_bn'] //快递编号
);
$exp = new exp($params['key']); //初始化类
 
$result = $exp->query($params['com'],$params['no']); //执行查询
 
if($result['error_code'] == 0){//查询成功
  $list = $result['result']['list'];
  
}else{
  echo "<br></br> 获取失败，原因：".$result['reason'];
}
 
class exp{
    private $appkey = false; //申请的快递查询APPKEY
 
    private $queryUrl = 'http://v.juhe.cn/exp/index';
 
    private $comUrl = 'http://v.juhe.cn/exp/com';
 
    public function __construct($appkey){
        $this->appkey = $appkey;
    }
 
    /**
     * 返回支持的快递公司公司列表
     * @return array
     */
    public function getComs(){
        $params = 'key='.$this->appkey;
        $content = $this->juhecurl($this->comUrl,$params);
        return $this->_returnArray($content);
    }
 
    public function query($com,$no){
        $params = array(
            'key' => $this->appkey,
            'com'  => $com,
            'no' => $no
        );
        $content = $this->juhecurl($this->queryUrl,$params,1);
        return $this->_returnArray($content);
    }
 
    /**
     * 将JSON内容转为数据，并返回
     * @param string $content [内容]
     * @return array
     */
    public function _returnArray($content){
        return json_decode($content,true);
    }
 
    /**
     * 请求接口返回内容
     * @param  string $url [请求的URL地址]
     * @param  string $params [请求的参数]
     * @param  int $ipost [是否采用POST形式]
     * @return  string
     */
    public function juhecurl($url,$params=false,$ispost=0){
        $httpInfo = array();
        $ch = curl_init();
 
        curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
        curl_setopt( $ch, CURLOPT_USERAGENT , 'JuheData' );
        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
        curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
        if( $ispost )
        {
            curl_setopt( $ch , CURLOPT_POST , true );
            curl_setopt( $ch , CURLOPT_POSTFIELDS , $params );
            curl_setopt( $ch , CURLOPT_URL , $url );
        }
        else
        {
            if($params){
                curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );
            }else{
                curl_setopt( $ch , CURLOPT_URL , $url);
            }
        }
        $response = curl_exec( $ch );
        if ($response === FALSE) {
            //echo "cURL Error: " . curl_error($ch);
            return false;
        }
        $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );
        $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );
        curl_close( $ch );
        return $response;
	
    }
	

}




?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>物流信息-众晒网</title>
    <link href="/ui/css/Hui.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
     #header{width:100%; position:absolute; top:0;}
     #footer{width:100%; height:55px; position:absolute; bottom:0;z-index:999;}	 
     #main{width:100%; overflow: auto; position:absolute; top:45px;bottom:0px;}
    </style>
    <script src="/ui/js/jquery.min.js"></script>
</head>
<body>
    <header class="H-header H-theme-background-color-white" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-10 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-theme-font-color-black H-font-size-18 H-vertical-middle"></i></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent H-font-weight-500">物流信息</div>
    </header>
    <div id="main">
    <div class="H-timeline H-padding-horizontal-both-10 H-border-horizontal-right-after">

	<?php foreach ($list as $v) { ?>
	
	        <div class="H-timeline-item H-z-index-100 H-theme-background-color-white H-margin-vertical-top-15 H-border-both-after H-animate-scale-big">
            <div class="H-timeline-dotline H-position-absolute H-z-index-1000">
                <div class="H-timeline-dot H-position-absolute H-z-index-1000 H-border-radius-circle"></div>
                <div class="H-timeline-line H-position-absolute H-z-index-1000"></div>
                <div class="H-timeline-bigdot H-center-all H-border-radius-circle H-position-absolute H-z-index-100000 H-theme-background-color-white">
                    <div class="H-timeline-bigdot-child H-border-radius-circle"></div>
                </div>
                <div class="H-timeline-dot H-position-absolute H-z-index-1000 H-border-radius-circle"></div>
            </div>
            <div class="H-timeline-header H-text-show-row-1 H-font-size-14 H-padding-10 H-line-height-normal H-theme-background-color-white H-border-vertical-bottom-after">
             <?php echo $v['datetime']; ?>
            </div>
            <div class="H-timeline-container H-padding-10 H-font-size-15">
           <?php echo $v['remark']; ?>
            </div>
        </div>
	<?php } ?>
	
	    </div>
	<br><br><br>
	
    </div>
     	
     <!--################################底部开始################################-->  	
     <?include('footer.php');?>
     <!--################################底部结束################################-->
    <script src="/ui/script/H.js" type="text/javascript"></script>
</body>
</html>